package com.ruoyi.project.infoprojecttargetscore.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.project.infoprojecttargetscore.domain.InfoProjectTargetScore;
import com.ruoyi.project.infoprojecttargetscore.service.IInfoProjectTargetScoreService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 目标审核-项目打分Controller
 *
 * @author ruoyi
 * @date 2022-02-14
 */
@RestController
@RequestMapping("/infoprojecttargetscore/infoProjectTargetScore")
public class InfoProjectTargetScoreController extends BaseController {
    @Autowired
    private IInfoProjectTargetScoreService infoProjectTargetScoreService;

    /**
     * 查询目标审核-项目打分列表
     */
    @PreAuthorize("@ss.hasPermi('infoprojecttargetscore:infoProjectTargetScore:list')")
    @GetMapping("/list")
    public TableDataInfo list(InfoProjectTargetScore infoProjectTargetScore) {
        startPage();
        List<InfoProjectTargetScore> list = infoProjectTargetScoreService.selectInfoProjectTargetScoreList(infoProjectTargetScore);
        return getDataTable(list);
    }

    /**
     * 导出目标审核-项目打分列表
     */
    @PreAuthorize("@ss.hasPermi('infoprojecttargetscore:infoProjectTargetScore:export')")
    @Log(title = "目标审核-项目打分", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, InfoProjectTargetScore infoProjectTargetScore) {
        List<InfoProjectTargetScore> list = infoProjectTargetScoreService.selectInfoProjectTargetScoreList(infoProjectTargetScore);
        ExcelUtil<InfoProjectTargetScore> util = new ExcelUtil<InfoProjectTargetScore>(InfoProjectTargetScore.class);
        util.exportExcel(response, list, "目标审核-项目打分数据");
    }

    /**
     * 获取目标审核-项目打分详细信息
     */
    @PreAuthorize("@ss.hasPermi('infoprojecttargetscore:infoProjectTargetScore:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(infoProjectTargetScoreService.selectInfoProjectTargetScoreById(id));
    }

    /**
     * 新增目标审核-项目打分
     */
    @PreAuthorize("@ss.hasPermi('infoprojecttargetscore:infoProjectTargetScore:add')")
    @Log(title = "目标审核-项目打分", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody InfoProjectTargetScore infoProjectTargetScore) {
        return toAjax(infoProjectTargetScoreService.insertInfoProjectTargetScore(infoProjectTargetScore));
    }

    /**
     * 修改目标审核-项目打分
     */
    @PreAuthorize("@ss.hasPermi('infoprojecttargetscore:infoProjectTargetScore:edit')")
    @Log(title = "目标审核-项目打分", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody InfoProjectTargetScore infoProjectTargetScore) {
        return toAjax(infoProjectTargetScoreService.updateInfoProjectTargetScore(infoProjectTargetScore));
    }

    /**
     * 删除目标审核-项目打分
     */
    @PreAuthorize("@ss.hasPermi('infoprojecttargetscore:infoProjectTargetScore:remove')")
    @Log(title = "目标审核-项目打分", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(infoProjectTargetScoreService.deleteInfoProjectTargetScoreByIds(ids));
    }
}
